/**
 * &copy; 2008 dataSentinel (http://www.datasentinel.com)
 * All Rights Reserved.
 */
package com.datasentinel.rooms.j3d.util;

import java.awt.Component;
import java.awt.Image;

import javax.media.j3d.Texture;

import com.sun.j3d.utils.image.TextureLoader;

/**
 * @author Rick Power
 * 
 */
public class ImagePlaneShape3D extends PlaneShape3D
{
	public ImagePlaneShape3D(Image image,Component component)
	{
		this();
		_setImage(image,component);
	}

	public ImagePlaneShape3D()
	{
		super();
	}

	public void setImage(Image image,Component component)
	{
		_setImage(image,component);
	}

	private void _setImage(Image image,Component component)
	{
		if(image == null)
		{
			getAppearance().setTexture(null);
			return;
		}
		TextureLoader textureLoader = new TextureLoader(image, component);
		Texture texture = textureLoader.getTexture();
		getAppearance().setTexture(texture);
	}
}
